<template>
  <div class="bg-[#232324] h-[100%]">
    <el-collapse v-loading="loading" v-model="activeNames">
      <el-form label-width="100" :model="states" size="default">
        <el-collapse-item :title="`指定变量（维度）`" name="asdfa">
          <KeyValueModule
            v-model:list="radarIndicator.indicator"
            key1="name"
            key2="max"
          />
        </el-collapse-item>
        <el-collapse-item
          :title="`雷达图`"
          :name="i + 1"
          v-for="(item, i) in states"
          :key="item.name + i + 'a'"
        >
          <el-form-item label="填充透明度">
            <el-input-number
              v-model="item.areaStyle.opacity"
              :step="0.1"
              :min="0"
              :max="1"
            />
          </el-form-item>
          <el-form-item label="线条类型">
            <el-select v-model="item.symbol" placeholder="Select">
              <el-option label="circle" value="circle" />
              <el-option label="rect" value="rect" />
              <el-option label="roundRect" value="roundRect" />
              <el-option label="triangle" value="triangle" />
              <el-option label="diamond" value="diamond" />
              <el-option label="pin" value="pin" />
              <el-option label="arrow" value="arrow" />
              <el-option label="none" value="none" />
            </el-select>
          </el-form-item>
        </el-collapse-item>
      </el-form>
    </el-collapse>
  </div>
</template>

<script setup>
import { computed, onMounted, watch, ref } from "vue";
import KeyValueModule from "@renderer/components/keyValueModule/index.vue";
const loading = ref(true);
const activeNames = ref();
const props = defineProps({
  models: {
    type: Object,
    default: () => ({}),
  },
});
const emit = defineEmits(["update:models", "edit"]);
let states = ref(null);
onMounted(() => {
  setTimeout(() => {
    loading.value = false;
  }, 200);

  states.value = JSON.parse(JSON.stringify(props.models.series));
});
let radarIndicator = computed({
  get() {
    return props.models.radar;
  },
  set(val) {
    emit("update:models", { ...props.models, radar: val });
  },
});

watch(
  () => states.value,
  (val) => {
    emit("update:models", { ...props.models, series: val });
  },
  {
    deep: true,
  }
);
</script>

<style scoped lang="scss">
:deep(.el-collapse-item__header) {
  padding-left: 10px !important;
}

// :deep(.el-input) {
//   width: 180px !important;
// }
:deep(.el-select) {
  width: 180px !important;
}

:deep(.el-table tr) {
  background-color: #232324 !important;
}
:deep(.el-table th.el-table__cell) {
  background-color: #232324 !important;
}
:deep(
    .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell
  ) {
  background-color: #484849 !important;
}
</style>
